package com.cloudxingkong.dianyinke.Student.Utils;

import com.cloudxingkong.dianyinke.Student.bean.KeMuTest;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ningfei on 2016/3/30.
 */
public class JsonObject {
    public static List<KeMuTest.ListBean> getDataJsonObject(String json){
        List<KeMuTest.ListBean> lists;

        try {
            lists=new ArrayList<>();
            KeMuTest.ListBean rawBean=new KeMuTest.ListBean();

            JSONArray array = new JSONArray(json);
            for (int i = 0; i < array.length(); i++) {
                JSONObject o1=array.getJSONObject(i);
                rawBean.setPname(o1.getString("pname"));
                rawBean.setPcode(o1.getString("pcode"));

                JSONArray array2=o1.getJSONArray("children");
                for (int i1 = 0; i1 < array2.length(); i1++) {
                    JSONObject o2=array2.getJSONObject(i1);

                }
            }

            return  lists;
        } catch (JSONException e) {
            e.printStackTrace();
        }


        return  null;
    }
}
